<template>
    <div>
        <el-dialog title="新增" v-model="editFormVisible" :close-on-click-modal="false">
            <el-form ref="form" :model="form" :rules="rules" label-width="110px">
                <el-form-item label="参数名" prop="FKey">
                    <el-input v-model="form.FKey" :readonly="true"></el-input>
                </el-form-item>
                <el-form-item label="参数值" prop="FValue">
                    <el-input v-model="form.FValue"></el-input>
                </el-form-item>
                <el-form-item label="备注">
                    <el-input type="textarea" v-model="form.FNote" :readonly="true"></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click.native="editFormVisible = false">取 消</el-button>
                <el-button type="primary" @click="save" :loading="loading">保存</el-button>
            </div>
      </el-dialog>
    </div>
</template>

<script>
    import util from '../../common/util'
    export default {
        data() {
            return {
                form: {},
                rules: {
                    FKey: [{required: true,message: '参数名', trigger: 'blur'}]
                },
                loading:false,
                editFormVisible:false
            }
        },
        methods: {
            _openEdit(record) {
                this.editFormVisible = true;
                this.form = Object.assign({},record);
            },
            _openAdd(record) {
                this.editFormVisible = true;
                this.form = {FID:0};
            },
            switchLoading(flag){
                this.loading = flag;
            },
            save:function () {
                util.post("server/system/System.ashx?cmd=Save",this.form,this.switchLoading,result=> {
                    util.msgSuc("保存成功")
                    this.editFormVisible = false
                    this.$emit("onSaveSuc",this.form)
                })
            }
        },
        mounted() {

        }
    }
</script>
